//package com.fyl.oauth2.config;
//
//import org.apache.ibatis.plugin.Interceptor;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.SqlSessionTemplate;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//import org.springframework.transaction.PlatformTransactionManager;
//
//import javax.sql.DataSource;
//import java.util.Properties;
//
///**
// * @Author: 黯然
// * @Date: 2025/4/8 15:41
// * @Description:
// */
//@Configuration
//@MapperScan(basePackages = {"com.fyl.oauth2.dao"},
//        sqlSessionFactoryRef = "sqlSessionFactoryMonitorDB")
//public class MybatisConfig {
//
//    @Autowired
//    @Qualifier("myDB")
//    private DataSource dataSource;
//
//    @Bean
//    public SqlSessionFactory sqlSessionFactoryMonitorDB() throws Exception {
//        SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
//        factoryBean.setDataSource(dataSource);
//
//        factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(
//                "classpath*:com/fyl/oauth2/dao/**/*.xml"));
//        //添加插件
////        factoryBean.setPlugins(new Interceptor[]{pageHelper2()});
////        factoryBean.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
//        return factoryBean.getObject();
//
//    }
//
//    @Bean
//    public SqlSessionTemplate sqlSessionTemplate1() throws Exception {
//        SqlSessionTemplate template = new SqlSessionTemplate(sqlSessionFactoryMonitorDB());
//        return template;
//    }
//
//
//    @Bean("greentranDBTransaction")
//    public PlatformTransactionManager txManager() {
//        return new DataSourceTransactionManager(dataSource);
//    }
//}
